<?php
/**
 * Created by PhpStorm.
 * User: FDG296
 * Date: 2017/7/10
 * Time: 15:33
 */
namespace common\models;

use Yii;
use yii\db\ActiveRecord;

class SysCity extends ActiveRecord{
    public static function tableName(){
        return '{{%sys_city}}';
    }

	/**
	 * @param 通过城市查询对应得code
	 */
	public static function getCode($name){
		$where = ['name'=>$name];
		return	self::find()->select(['code'])->where($where)->one();
	}

	/**
	 * @param 通过城市查询对应得code
	 */
	public static  function getName($id){
		$where = ['id'=>$id];
		return	self::find()->select(['name'])->where($where)->one();
	}
}